<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class StormSmsJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $phone;
    
    protected $isSuccess;
    
    public function __construct($phone, $isSuccess = true)
    {
        $this->phone = $phone;
        $this->isSuccess = $isSuccess;
    }
    
    public function handle()
    {
    	$template = $this->isSuccess ? 'SMS_244560194' : 'SMS_244530196';
    	
    	app('easysms')->send($this->phone, ['template' => $template]);
    }
}
